﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Emgu.CV;

namespace svc
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var capture = new ImageCapture(CvInvoke.cvCreateFileCapture(@"D:\Work\lepttest\images\source8x.wmv")))
            {
                var settings = new SpaceDetectorSettings();

                int key = 0;
                while (key != 'q')
                {
                    if (key == '+')
                        settings.Scaling *= 1.2F;
                    else if (key == '-')
                        settings.Scaling /= 1.2F;

                    ImageFrame frame = capture.QueryFrame();
                    if (!frame.IsValid)
                        break;

                    SpaceDetector detector = new SpaceDetector(settings);

                    Parking p = ParkingDBMock.Read(0);
                    detector.DetectSpaces(p.bbox, p.zones, frame);
                    ParkingDBMock.Update(p);
                    ParkingDBMock.UpdateZones(p.zones);

                    key = CvInvoke.cvWaitKey(10);
                }

            }
        }
    }
}
